{include file="public_tpl/head"/}
<title>管理员管理 - 权限节点添加 - {$cfg_website}</title>
<meta name="keywords" content="{$cfg_keywords?:''}">
<meta name="description" content="{$cfg_description?:''}">
</head>
<body>
<!--面包屑-->
<nav class="breadcrumb">
    <i class="Hui-iconfont">&#xe67f;</i> 首页
    <span class="c-gray en">&gt;</span> 管理员管理
    <span class="c-gray en">&gt;</span> 权限节点编辑
    <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px"
       href="javascript:location.replace(location.href);" title="刷新">
        <i class="Hui-iconfont">&#xe68f;</i>
    </a>
</nav>
<!--/面包屑-->

<div class="page-container">
    <form action="{:url('edit')}" method="post" class="form form-horizontal" id="form-admin-role-add">
        <div class="row cl">
            <input name="id" type="hidden" value="{$item.id}">
            <input name="pid" type="hidden" value="{$item.pid}">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>节点名称：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="{$item.name}" placeholder="" id="name" name="name">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">仅为分组：</label>
            <div class="formControls col-xs-8 col-sm-9 form-group form-inline">
                <label class="">
                    是：<input type="radio" id="menu_group_1" class="form-control " value="1" name="menu_group"/>
                </label>
                <label class="">
                    否：<input type="radio" id="menu_group_0" class="form-control" value="0" name="menu_group"/>
                </label>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">控制器：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <select id="controller" class="input-text" data-value="{$item.controller}" name="controller"></select>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">操作：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <select id="action" class="input-text" data-value="{$item.action}"  name="action"></select>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">参数：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="{$item.param}" placeholder="key1=val1&key2=val2" name="param">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">图标：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="{$item.icon}" placeholder="" name="icon">
                <span>图标参见 http://www.h-ui.net/Hui-3.7-Hui-iconfont.shtml</span>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">排序：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="{$item.list_order}" placeholder="" name="list_order">
            </div>
        </div>
        {neq name="item.level" value="4"}
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">是否显示：</label>
            <div class="skin-minimal col-xs-8 col-sm-9">
                <div class="check-box">
                    <label for="is_show">是</label>
                    <input type="checkbox" id="is_show" class="icheckbox-blue" value="1" name="is_show" {$item.is_show?'checked':''}>
                </div>
            </div>
        </div>
        {/neq}
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">备注：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <textarea class="textarea" placeholder="说点什么..." rows="5" cols="" name="remark">{$item.remark}</textarea>
            </div>
        </div>
        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <button type="submit" class="btn btn-success radius"><i class="icon-ok"></i> 确定</button>
            </div>
        </div>
    </form>
</div>
{include file="public_tpl/script"/}
<script>
    $(function () {
        (function() {
            var controller = $('#controller').data('value');
            var action = $('#action').data('value');
            var menu_group = "{$item.menu_group}";
            //var pid = $('#pid').val();
            $('#controller').load('{:url("admin/get.api/controllers")}?controller='+controller);
            $('#action').load('{:url("admin/get.api/actions")}?controller='+controller+'&action='+action);
            console.log('#menu_group_'+menu_group);

            //$('#pid').load('{:url("admin/get.api/parentNode")}?pid='+pid+'$id={$Request.param.id}');
            $('#menu_group_1').on('click',function (e) {
                $('#controller').addClass('disabled').val('');
                $('#action').addClass('disabled').val('');
            });
            $('#menu_group_0').on('click',function (e) {
                $('#controller').removeClass('disabled').load('{:url("admin/get.api/controllers")}?controller='+controller);
                $('#action').removeClass('disabled').load('{:url("admin/get.api/actions")}?controller='+controller+'&action='+action);
            });
            $('#controller').on('change',function (e) {
                var controller = $('#controller').val();
                $('#action').load('{:url("admin/get.api/actions")}?controller='+controller);
            });
            $('#menu_group_'+menu_group).click();
        })();
        
    });
</script>
</body>
</html>